package ar.com.mindset.example
{
	import ar.com.mindset.geometrics.ColorEntry;
	import ar.com.mindset.geometrics.ColorScheme;
	import ar.com.mindset.geometrics.MapItem;
	import ar.com.mindset.geometrics.RegionData;
	import ar.com.mindset.geometrics.legends.ListLegend;
	
	import com.degrafa.GeometryGroup;
	import com.degrafa.paint.SolidFill;
	
	import mx.collections.ArrayCollection;
	
	public class FirstCharColorScheme extends ColorScheme
	{
		public override function getLegend():GeometryGroup{
			var retVal:ListLegend = new ListLegend(); 
			
			retVal.initialize(new ArrayCollection([new ColorEntry("Start with 'C'", "#FF0000")]), "#0000FF");
			
			return retVal;	
		}
		
		public override function prepare(mapItem:MapItem, regionData:RegionData):void
		{
			var solidFill:SolidFill = new SolidFill()
			if(mapItem.name.charAt(0).toUpperCase() == "C"){
				solidFill.color = "#FF0000";				
			}else{
				solidFill.color = "#0000FF";				
			}
			mapItem.fillcolor = solidFill;
		}
		
		public function toString():String{
			return "First char";	
		}

	}
	
}